
package com.x52im.mall.logic.score;

import java.util.ArrayList;

import android.os.Bundle;
import android.widget.ListView;

import com.eva.framework.dto.DataFromClient;
import com.eva.framework.dto.DataFromServer;
import com.eva.framework.dto.SysActionConst;
import com.x52im.mall.dto.CommonProcessorConst;
import com.x52im.mall.score.dto.JobDispatchConst;
import com.x52im.mall.score.dto.TokenRechangeHistory;
import com.x52im.rbchat.R;
import com.x52im.mall.MallGlobal;
import com.x52im.mall.logic.shop.HistoryListAdapter;
import com.eva.android.widget.DataLoadableActivity;

public class RechargeHistoryActivity extends DataLoadableActivity
{
	private HistoryListAdapter lvRechangeHistoryAdapter;
	private ListView rechangeHistoryListView;

	@Override
	protected void initViews(Bundle savedInstanceState)
	{
		customeTitleBarResId = R.id.common_score_layout_recharge_history_titleBar;
		// 首先设置contentview
		setContentView(R.layout.common_score_layout_recharge_history_activity);

		this.setTitle(R.string.common_mall_recharge_history_title);
		
		rechangeHistoryListView = (ListView) this.findViewById(R.id.rechange_history_list_view);
		lvRechangeHistoryAdapter = new HistoryListAdapter(this);
		rechangeHistoryListView.setAdapter(lvRechangeHistoryAdapter);
	}

	@Override
	protected void initListeners()
	{

	}

	/* (non-Javadoc)
	 * @see com.eva.android.widget.DataLoadableActivity#queryData(java.lang.String[])
	 */
	@Override
	protected DataFromServer queryData(String... arg0)
	{
		// 要发送给服务端的对象
		return MallGlobal.getMallProviderInstance(this).getRobotimeMall().getAuthedService().sendObjToServer(
				DataFromClient.n().setProcessorId(CommonProcessorConst.PROCESSOR_SCORE)
						.setJobDispatchId(JobDispatchConst.SCORE_RECHARGE_ETC)
						.setActionId(SysActionConst.ACTION_QUERY)
						.setNewData(MallGlobal.getMallProviderInstance(this).getRobotimeMall().getLoginedUserUid()));
	}

	/* (non-Javadoc)
	 * @see com.eva.android.widget.DataLoadableActivity#refreshToView(java.lang.Object)
	 */
	@SuppressWarnings("unchecked")
	@Override
	protected void refreshToView(Object result)
	{
		ArrayList<TokenRechangeHistory> listData = (ArrayList<TokenRechangeHistory>) result;
		lvRechangeHistoryAdapter.setListData(listData);
		lvRechangeHistoryAdapter.notifyDataSetChanged();
//		Utility.setListViewHeightBasedOnChildren(rechangeHistoryListView);
	}
	
}
